{% extends 'base.html' %}
{% block title %}公开课 - 慕学在线网{% endblock %}

{% block mianbaoxie %}
    <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="/">首页</a>></li>
                <li>公开课</li>
            </ul>
        </div>
    </section>
{% endblock %}
{% block content %}
<section>
	<div class="wp">
		<div class="list" style="margin-top:0;">
			<div class="left layout">
				<div class="head">
					<ul class="tab_header">
						<li {% if sort == '' %}class="active"{% endif %}><a href="?sort=">最新 </a></li>
						<li {% if sort == 'hot' %}class="active"{% endif %}><a href="?sort=hot">最热门</a></li>
						<li {% if sort == 'students' %}class="active"{% endif %}><a href="?sort=students">参与人数</a></li>
					</ul>
				</div>
                <div id="inWindow">
                    <div class="tab_cont " id="content">
					<div class="group_list">
                        {% for course in all_course %}
                            <div class="box">
                                <a href="{% url 'course:course_detail' course.id %}">
                                    <img width="280" height="350" class="scrollLoading" src="/media/{{ course.image }}"/>
                                </a>
                                <div class="des">
                                    <a href="{% url 'course:course_detail' course.id %}">
                                        <h2>{{ course.name }}</h2>
                                    </a>
                                    <span class="fl">时长：<i class="key">{{ course.learn_times }}</i></span>
                                    <span class="fr">学习人数：{{ course.students }}&nbsp;&nbsp;</span>
                                </div>
                                <div class="bottom">
                                    <a href="{% url 'course:course_detail' course.id %}"><span class="fl">来自{{ course.course_org.name }}</span></a>
                                    <span class="star fr  notlogin
                                        " data-favid="15">
                                        {{ course.fav_nums }}
                                    </span>
                                </div>
                            </div>
                        {% endfor %}
					</div>
                    <div class="pageturn">
                        <ul class="pagelist">
                            <!-- 分页 -->
                            {% if all_course.has_previous %}
                                <li class="long"><a href="?sort={{ sort }}&page=1">首页</a></li>
                                <li class="long"><a href="?sort={{ sort }}&page={{ all_course.previous_page_number }}">上一页</a></li>
                            {% endif %}
                            {% if all_course.has_next %}
                                <li class="long"><a href="?sort={{ sort }}&page={{ all_course.next_page_number }}">下一页</a></li>
                                <li class="long"><a href="?sort={{ sort }}&page={{ all_course.paginator.num_pages }}">尾页</a></li>
                            {% endif %} 
                        </ul>
                    </div>
				</div>
                </div>
			</div>
			<div class="right layout">
				<div class="head">热门课程推荐</div>
				<div class="group_recommend">
                    {% for hot in hot_course %}
                        <dl>
                            <dt>
                                <a target="_blank" href="{% url 'course:course_detail' hot.id %}">
                                    <img width="240" height="220" class="scrollLoading" src="/media/{{ hot.image }}"/>
                                </a>
                            </dt>
                            <dd>
                                <a target="_blank" href="{% url 'course:course_detail' hot.id %}"><h2> {{ hot.name }}</h2></a>
                                <span class="fl">难度：<i class="key">{{ hot.get_degree_display }}</i></span>
                            </dd>
                        </dl>
                    {% endfor %}
				</div>
			</div>
		</div>
	</div>
</section>
{% endblock %}

